package com.fengmi.controller;

import com.fengmi.cart.entity.Cart;
import com.fengmi.service.ICartService;
import com.fengmi.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("cart")
public class CartController {

    @Autowired
    private ICartService cartService;

    @RequestMapping("add")
    public ResultVO add(String skuId,Integer buyNum){

        return cartService.add(skuId,buyNum);
    }

    @RequestMapping("list")
    public List<Cart> list(){

        return cartService.listCart();
    }

    @RequestMapping("delete")
    public ResultVO delete(String skuId){

        return cartService.delete(skuId);
    }

    @RequestMapping("jieduan")
    public ResultVO jieduan(@RequestBody List<Cart> carts){

        return cartService.jieduan(carts);
    }






}
